<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>

<%
    String path = request.getContextPath();
    String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort() + path + "/";
%>
<html style="height: auto; min-height: 100%;">
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <title>天津市西青医院满意度调查问卷</title>
    <!-- Tell the browser to be responsive to screen width -->
    <meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" name="viewport">
    <!-- Bootstrap 3.3.7 -->
    <link rel="stylesheet" href="<%=basePath%>bower_components/bootstrap/dist/css/bootstrap.min.css">
    <!-- Font Awesome -->
    <link rel="stylesheet" href="<%=basePath%>bower_components/font-awesome/css/font-awesome.min.css">
    <!-- Ionicons -->
    <link rel="stylesheet" href="<%=basePath%>bower_components/Ionicons/css/ionicons.min.css">
    <!-- Theme style -->
    <link rel="stylesheet" href="<%=basePath%>dist/css/AdminLTE.min.css">
    <!-- AdminLTE Skins. Choose a skin from the css/skins
         folder instead of downloading all of them to reduce the load. -->
    <link rel="stylesheet" href="<%=basePath%>dist/css/skins/_all-skins.min.css">
    <!-- Validator style -->
    <link href="<%=basePath %>bootstrap/bootstrapvalidator/dist/css/bootstrapValidator.min.css" rel="stylesheet"/>
    <link href="<%=basePath %>bootstrap/bootstrap-table/dist/bootstrap-table.css" rel="stylesheet"/>
    <link href="<%=basePath %>bootstrap/bootoast/dist/bootoast.min.css" rel="stylesheet"/>
</head>
<body class="skin-blue sidebar-mini" style="height: auto; min-height: 100%;">
<div class="wrapper" style="height: auto; min-height: 100%;">
    <!-- header头部页面 -->
    <jsp:include page="../commend/top.jsp"/>
    <!-- Left side column. contains the logo and sidebar -->
    <jsp:include page="../commend/left.jsp"/>

    <!-- Content Wrapper. Contains page content -->
    <div class="content-wrapper" style="min-height: 800px;">
        <!-- Content Header (Page header) -->
        <section class="content-header">
            <h1>

                <small>评价表</small>
            </h1>
            <ol class="breadcrumb">
                <li><a href="#"><i class="fa fa-dashboard"></i> 首页</a></li>
                <li class="active">评价表</li>
            </ol>
        </section>

        <!-- Main content -->
        <section class="content">
            <!-- Info boxes -->
            <!-- Main row -->
            <div class="row">
                <div class="col-md-12">
                    <div class="box">
                        <div class="box-header with-border">
                            <h3 class="box-title">科室列表</h3>
                        </div>
                        <!-- /.box-header -->
                        <div class="box-body ">
                            <div class="row ">
                                <div class="col-md-12 " >
                                    <table
                                            id="table"
                                            data-toggle="table"
                                            data-height="400"
                                            data-url="<%=basePath %>/deptMapper/selectDeptUpcomingPaper?deptid=${deptid}"
                                            style="font-size: 100%"
                                    >
                                        <thead>
                                        <tr>
                                            <th data-field="evalDeptNameString" data-width="50%" data-formatter="operateFormatter">评价科室</th>
                                            <th data-field="name">评价问卷名称</th>
                                            <th data-field="papername" data-formatter="caozuoformatter" data-events="operateEvent">操作</th>
                                        </tr>
                                        </thead>
                                    </table>
                                    <c:if test="${isAllow}">
                                        <div class="form-group">
                                            <label>对工作的合理化建议</label>
                                            <textarea class="form-control" id="context" rows="5" placeholder="对工作的合理化建议 ..."></textarea>
                                        </div>
                                        <div class="form-group">
                                            <label>您对院务公开信息具体内容的意见和建议</label>
                                            <textarea class="form-control" id="information" rows="5" placeholder="您对院务公开信息具体内容的意见和建议 ..."></textarea>
                                        </div>

                                    </c:if>

                                </div>
                            </div>
                            <!-- /.row -->
                        </div>
                        <!-- ./box-body -->
                        <div class="box-footer">
                            <c:if test="${isAllow}">
                                <button id="btn_submit" type="button" class="btn btn-primary">提交</button>
                            </c:if>
                        </div>
                        <!-- /.box-footer -->
                    </div>
                    <!-- /.box -->
                </div>
            </div>
            <!-- /.row -->
        </section>
        <!-- /.content -->
        <form action="<%=basePath%>/eval/evalPage" method="post" name="form1">
            <input type="hidden" name="paperId">
            <input type="hidden" name="cycledate">
        </form>
    </div>
    <!-- /.content-wrapper -->
    <!-- footer-->
    <jsp:include page="../commend/footer.jsp"/>
</div>

<!-- jQuery 3 -->
<script src="<%=basePath %>bower_components/jquery/dist/jquery.min.js"></script>
<!-- Bootstrap 3.3.7 -->
<script src="<%=basePath %>bower_components/bootstrap/dist/js/bootstrap.min.js"></script>
<!-- FastClick -->
<script src="<%=basePath %>bower_components/fastclick/lib/fastclick.js"></script>
<!-- AdminLTE App -->
<script src="<%=basePath %>dist/js/adminlte.min.js"></script>
<!-- AdminLTE for demo purposes -->
<script src="<%=basePath %>dist/js/demo.js"></script>
<!-- Validator 3.3.7 -->
<script src="<%=basePath %>bootstrap/bootstrapvalidator/dist/js/bootstrapValidator.min.js"></script>
<script src="<%=basePath %>bootstrap/bootstrapvalidator/dist/js/language/zh_CN.js"></script>
<!-- bootstrap-table -->
<script src="<%=basePath %>bootstrap/bootstrap-table/dist/bootstrap-table.js"></script>
<script src="<%=basePath %>bootstrap/bootstrap-table/dist/locale/bootstrap-table-zh-CN.min.js"></script>
<!-- bootbox -->
<script src="<%=basePath %>bootstrap/bootbox/bootbox.min.js"></script>
<script src="<%=basePath %>bootstrap/bootoast/dist/bootoast.min.js"></script>
<script src="<%=basePath %>bootstrap/commend/initcommend.js"></script>

<script>
    $(function() {
        $("#btn_submit").click(function () {
            var rows =  $("#table").bootstrapTable("getData");
            if (rows.length > 0){
                bootbox.alert('还有没有填写的调查问卷');
            }else{
                $.post(getRootPath_web()+"/suggestion/addTSuggestion",{
                    context:$("#context").val(),
                    information:$("#information").val()
                },function (data) {
                    if (data){
                        bootbox.alert('提交成功',function () {
                            window.location.href = getRootPath_web()+'/jsp/index.jsp'
                        });
                    } else {
                        bootbox.alert('提交失败');
                    }
                },'json')
            }
        })
    })
    function operateFormatter(value, row) {
        value=value?value:'';
        var length=value.length;
        if(length>27){
            length=26;
        }

        return "<span title ='"+value+"'>"+value.substring(0,length)+"...</span>"
    }
    function caozuoformatter() {
        var buttonarray = new Array();
        buttonarray[0] = '<button type="button" class="RoleOfedit btn btn-primary  btn-sm" style="margin-right:15px;">填报调查问卷</button>';
        return buttonarray.join('');
    }
    window.operateEvent = {
        'click .RoleOfedit': function (e, value, row, index) {
            //$("input[name=paperId]").val(row.paperId);
            //$("input[name=cycledate]").val(row.cycledate);
            window.location.href=getRootPath_web()+"/eval/evalPage/"+row.paperId+"/"+row.cycledate+"/"
           // $("form[name=form1]").submit();
        }
    }


</script>

</body>
</html>
